package com.university.mentalhealthplatform.teacherV2.repository;


import com.university.mentalhealthplatform.appModels.FamilyMessage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FamilyMessageRepositoryV2 extends JpaRepository<FamilyMessage, Long> {

    @Query("SELECT fm FROM FamilyMessage fm WHERE fm.name LIKE %:keyword% OR fm.fatherName LIKE %:keyword% OR fm.motherName LIKE %:keyword% OR fm.fatherPhone LIKE %:keyword% OR fm.motherPhone LIKE %:keyword% OR fm.homeAddress LIKE %:keyword%")
    List<FamilyMessage> findByKeyword(String keyword);
}